// pages/population/population.js
Page({

  data: {
    flag: 0,
    flag1: 0,
    flag2: 0,
    flag3: 0,
    flag4: 0,
    flag5: 0,
    flag6: 0,
    flag7: 0,
    flag8: 0,
    flag9: 0,
    flag10: 0,
    flag11: 0,
    flag12: 0,
    flag13: 0,
    flag14: 0,
    flag15: 0,
    flag16: 0,
    house: [
      { value: 0, name: '无', },
      { value: 1, name: '有', },
    ],
    gender: [
      { value: 1, name: '男', },
      { value: 2, name: '女', },
    ],
    volunteer: [
      { value: 0, name: '否', },
      { value: 1, name: '是', },
    ],
    person_house_match: [
      { value: 1, name: '一致', },
      { value: 2, name: '不一致', },
    ],
    // 特殊人群
    specialArr: [
      { value: 0, name: '请选择' },
      { value: 1, name: '否' },
      { value: 2, name: '刑释解教人员' },
      { value: 3, name: '从事邪教人员' },
      { value: 4, name: '长期涉法涉诉' },
      { value: 5, name: '吸毒人员' },
      { value: 6, name: '社区矫正对象' },
      { value: 7, name: '服刑人员' },
    ],
    specialIdx: 0,
    freedom: '',
    // 与户主关系
    familyArr: [
      {
        value: 0,
        name: '请选择'
      },
      {
        value: 1,
        name: '户主本人'
      },
      {
        value: 2,
        name: '配偶'
      },
      {
        value: 3,
        name: '子女'
      },
      {
        value: 4,
        name: '兄弟姐妹'
      },
      {
        value: 5,
        name: '儿媳（婿）'
      },
      {
        value: 6,
        name: '（岳）父母'
      },
      {
        value: 7,
        name: '祖父母'
      },
      {
        value: 8,
        name: '（重）孙'
      },
      {
        value: 9,
        name: '重）孙媳（婿）'
      },
      {
        value: 10,
        name: '其他'
      },
    ],
    familyIdx: 0,
    birth: '',
    nation: '',
    manageIdx: 0,
    marry: '',
    marryIdx: 0,
    religionIdx: 0,
    region: '',
    politicsIdx: 0,
    eduIdx: 0,
    jobIdx: 0,
    residence: '',
    current_live_place: '',
    healthIdx: 0,
    societyDutyIdx: 0,
    birthControlIdx: 0,
    bloodIdx: 0,
    skillIdx: 0,
    residenceTypeIdx: 0,
    militaryIdx: 0,
    nationIdx: 0,
    manageArr: [
      {
        value: 0,
        name: '请选择'
      },
      {
        value: 1,
        name: '人户同在'
      },
      {
        value: 2,
        name: '人在户不在'
      },
      {
        value: 3,
        name: '流动（流入）'
      },
      {
        value: 4,
        name: '流动（流出）'
      },
    ],
    marryArr: [
      {
        value: 0,
        name: '请选择'
      },
      {
        value: 1,
        name: '未婚'
      },
      {
        value: 2,
        name: '已婚'
      },
      {
        value: 3,
        name: '离异'
      },
      {
        value: 4,
        name: '丧偶'
      },
      {
        value: 5,
        name: '其他'
      },
    ],
    religionArr: [
      {
        value: 0,
        name: '请选择'
      },
      {
        value: 1,
        name: '基督教'
      },
      {
        value: 2,
        name: '道教'
      },
      {
        value: 3,
        name: '佛教'
      },
      {
        value: 4,
        name: '伊斯兰教'
      },
      {
        value: 5,
        name: '天主教'
      },
      {
        value: 6,
        name: '其他'
      },
    ],
    politicsArr: [
      {
        value: 0,
        name: '请选择'
      },
      {
        value: 1,
        name: '中共党员'
      },
      {
        value: 2,
        name: '中共预备党员'
      },
      {
        value: 3,
        name: '共青团员'
      },
      {
        value: 4,
        name: '民革党员'
      },
      {
        value: 5,
        name: '民盟盟员'
      },
      {
        value: 6,
        name: '民建会员'
      },
      {
        value: 7,
        name: '民进会员'
      },
      {
        value: 8,
        name: '农工党党员'
      },
      {
        value: 9,
        name: '致公党党员'
      },
      {
        value: 10,
        name: '九三学社社员'
      },
      {
        value: 11,
        name: '台盟盟员'
      },
      {
        value: 12,
        name: '无党派人士'
      },
      {
        value: 13,
        name: '群众'
      },
    ],
    eduArr: [
      {
        value: 0,
        name: '请选择'
      },
      {
        value: 1,
        name: '幼儿园'
      },
      {
        value: 2,
        name: '小学'
      },
      {
        value: 3,
        name: '初中'
      },
      {
        value: 4,
        name: '高中'
      },
      {
        value: 5,
        name: '中专'
      },
      {
        value: 6,
        name: '大专'
      },
      {
        value: 7,
        name: '本科'
      },
      {
        value: 8,
        name: '硕士'
      },
      {
        value: 9,
        name: '博士'
      },
      {
        value: 10,
        name: '博士后'
      },
    ],
    jobArr: [
      {
        value: 0,
        name: '请选择'
      },
      {
        value: 1,
        name: '农民'
      },
      {
        value: 2,
        name: '工人'
      },
      {
        value: 3,
        name: '干部'
      },
      {
        value: 4,
        name: '教师'
      },
      {
        value: 5,
        name: '学生'
      },
      {
        value: 6,
        name: '儿童'
      },
      {
        value: 7,
        name: '无业'
      },
      {
        value: 8,
        name: '个体'
      },
      {
        value: 9,
        name: '其他'
      },
    ],
    healthArr: [
      {
        value: 0,
        name: '请选择'
      },
      {
        value: 1,
        name: '很好'
      },
      {
        value: 2,
        name: '良好'
      },
      {
        value: 3,
        name: '一般'
      },
      {
        value: 4,
        name: '较差'
      },
      {
        value: 5,
        name: '很差'
      }
    ],
    societyDutyArr: [
      {
        value: 0,
        name: '请选择'
      },
      {
        value: 1,
        name: '楼组长'
      },
      {
        value: 2,
        name: '居民组长'
      },
      {
        value: 3,
        name: '人大代表'
      },
      {
        value: 4,
        name: '政协委员'
      },
      {
        value: 5,
        name: '社会法官'
      },
      {
        value: 6,
        name: '监督员'
      },
      {
        value: 7,
        name: '老教师'
      },
      {
        value: 8,
        name: '老干部'
      },
      {
        value: 9,
        name: '老党员'
      },
      {
        value: 10,
        name: '其他'
      },
    ],
    birthControlArr: [
      {
        value: 0,
        name: '请选择'
      },
      {
        value: 1,
        name: '药物'
      },
      {
        value: 2,
        name: '节育环'
      },
      {
        value: 3,
        name: '结扎'
      },
      {
        value: 4,
        name: '其他'
      },
    ],
    bloodArr: [
      {
        value: 0,
        name: '请选择'
      },
      {
        value: 1,
        name: 'A型'
      },
      {
        value: 2,
        name: 'B型'
      },
      {
        value: 3,
        name: 'AB型'
      },
      {
        value: 4,
        name: 'O型'
      },
      {
        value: 5,
        name: '未知'
      },
      {
        value: 6,
        name: '其他'
      },
    ],
    skillArr: [
      {
        value: 0,
        name: '请选择'
      },
      {
        value: 1,
        name: '绘画'
      },
      {
        value: 2,
        name: '书法'
      },
      {
        value: 3,
        name: '表演'
      },
      {
        value: 4,
        name: '摄影'
      },
      {
        value: 5,
        name: '化妆'
      },
      {
        value: 6,
        name: '外语'
      },
      {
        value: 7,
        name: '活动策划'
      },
      {
        value: 8,
        name: '其他'
      },
    ],
    residenceTypeArr: [
      {
        value: 0,
        name: '请选择'
      },
      {
        value: 1,
        name: '农业户'
      },
      {
        value: 2,
        name: '非农业户'
      },
      {
        value: 3,
        name: '其他'
      },
    ],
    militaryArr: [
      {
        value: 0,
        name: '请选择'
      },
      {
        value: 1,
        name: '未服兵役'
      },
      {
        value: 2,
        name: '退出兵役'
      },
      {
        value: 3,
        name: '士官预备役'
      },
      {
        value: 4,
        name: '军官预备役'
      },
      {
        value: 5,
        name: '服现役'
      },
      {
        value: 6,
        name: '其他'
      },
    ],
    nationArr: [
      { value: 0, name: '汉族' },
      { value: 1, name: '蒙古族' },
      { value: 2, name: '回族' },
      { value: 3, name: '藏族' },
      { value: 4, name: '维吾尔族' },
      { value: 5, name: '苗族' },
      { value: 6, name: '彝族' },
      { value: 7, name: '壮族' },
      { value: 8, name: '布依族' },
      { value: 9, name: '朝鲜族' },
      { value: 10, name: '满族' },
      { value: 11, name: '侗族' },
      { value: 12, name: '瑶族' },
      { value: 13, name: '白族' },
      { value: 14, name: '土家族' },
      { value: 15, name: '哈尼族' },
      { value: 16, name: '哈萨克族' },
      { value: 17, name: '傣族' },
      { value: 18, name: '黎族' },
      { value: 19, name: '僳僳族' },
      { value: 20, name: '佤族' },
      { value: 21, name: '畲族' },
      { value: 22, name: '高山族' },
      { value: 23, name: '拉祜族' },
      { value: 24, name: '水族' },
      { value: 25, name: '东乡族' },
      { value: 26, name: '纳西族' },
      { value: 27, name: '景颇族' },
      { value: 28, name: '柯尔克孜族' },
      { value: 29, name: '土族' },
      { value: 30, name: '达斡尔族' },
      { value: 31, name: '仫佬族' },
      { value: 32, name: '羌族' },
      { value: 33, name: '布朗族' },
      { value: 34, name: '撒拉族' },
      { value: 35, name: '毛南族' },
      { value: 36, name: '仡佬族' },
      { value: 37, name: '锡伯族' },
      { value: 38, name: '阿昌族' },
      { value: 39, name: '普米族' },
      { value: 40, name: '塔吉克族' },
      { value: 41, name: '怒族' },
      { value: 42, name: '乌孜别克族' },
      { value: 43, name: '俄罗斯族' },
      { value: 44, name: '鄂温克族' },
      { value: 45, name: '德昂族' },
      { value: 46, name: '保安族' },
      { value: 47, name: '裕固族' },
      { value: 48, name: '京族' },
      { value: 49, name: '塔塔尔族' },
      { value: 50, name: '独龙族' },
      { value: 51, name: '鄂伦春族' },
      { value: 52, name: '赫哲族' },
      { value: 53, name: '门巴族' },
      { value: 54, name: '珞巴族' },
      { value: 55, name: '基诺族' },
    ],
    rawData: [],//后台获取的原始数组
    multiObjArray: [], //整理后在页面循环的数组
    multiIndex: [0, 0],
    flag: 0,
    comArr: [],
    gridArr: [],
    newArr: [],
    g_id: '',
    c_id: '',
    chooseIdx: 0,
    chooseIdx2: 0,
    flag20: 0,
    flag21: 0,
    id: '',
    crime_name: ''
  },

  onLoad(opts) {
    console.log(opts)
    this.setData({
      id: opts.id
    })
    wx.showLoading({
      title: '加载中...',
    })
  },

  onShow() {
    let pages = getCurrentPages();
    let prevPage = pages[pages.length - 2];   //上一页
    prevPage.setData({
      status: 1
    })
    this.getHouse()
    setTimeout(() => {
      this.loadInfo()
    }, 500)

  },

  getHouse() {
    let access_token = wx.getStorageSync('access_token')
    wx.request({
      url: 'https://baokang.wshoto.com/wx/listallhouse',
      data: {
        access_token: access_token
      },
      success: (res) => {
        console.log(res)
        console.log(res.data.list.house_list)
        if (res.data.code == 1) {
          this.setData({
            houseList: res.data.list.house_list,
            typeList: res.data.list.type_list
          })
        }
      }
    })
  },

  loadInfo() {
    let that = this
    let access_token = wx.getStorageSync('access_token')
    let id = that.data.id
    wx.request({
      url: 'https://baokang.wshoto.com/wx/basicinfo',
      data: {
        access_token: access_token,
        type: 2,
        id: id
      },
      success: (res) => {
        console.log(res)
        if (res.data.code == 1) {
          for (let i in that.data.houseList) {
            if (that.data.houseList[i].h_id == res.data.info.h_id) {
              that.setData({
                chooseIdx: i
              })
            }
          }
          for (let i in that.data.typeList) {
            if (that.data.typeList[i].type_id == res.data.info.person_type) {
              that.setData({
                chooseIdx2: i
              })
            }
          }
          that.setData({
            listInfo: res.data.info,
            specialIdx: res.data.info.special_type,
            familyIdx: res.data.info.family_relation,
            nationIdx: res.data.info.nation,
            manageIdx: res.data.info.manage_type,
            marryIdx: res.data.info.marry_remark,
            politicsIdx: res.data.info.politics_face,
            religionIdx: res.data.info.religion_belief,
            eduIdx: res.data.info.educational,
            healthIdx: res.data.info.health_remark,
            bloodIdx: res.data.info.blood_type,
            residenceTypeIdx: res.data.info.residence_type,
            militaryIdx: res.data.info.military_service_remark,
            freedom: res.data.info.freedom_date,
            birth: res.data.info.birth_day,
            marry: res.data.info.marry_date,
            residence: res.data.info.residence_place,
            current_live_place: res.data.info.current_live_place,
            region: res.data.info.birth_place,
            flag1: 1,
            flag2: 1,
            flag3: 1,
            flag4: 1,
            flag5: 1,
            flag6: 1,
            flag7: 1,
            flag8: 1,
            flag10: 1,
            flag13: 1,
            flag15: 1,
            flag16: 1,
            flag20: 1,
            flag21: 1,
          })
          // 有无房屋
          if (res.data.info.has_house == 0) {
            that.data.house[0].selected = true;
            that.data.house[1].selected = false
            that.setData({
              house: that.data.house
            })
          } else {
            that.data.house[0].selected = false;
            that.data.house[1].selected = true
            that.setData({
              house: that.data.house
            })
          }
          // 性别
          if (res.data.info.gender == 1) {
            that.data.gender[0].selected = true;
            that.data.gender[1].selected = false
            that.setData({
              gender: that.data.gender
            })
          } else {
            that.data.gender[0].selected = false;
            that.data.gender[1].selected = true
            that.setData({
              gender: that.data.gender
            })
          }
          // 人户一致
          if (res.data.info.person_house_match == 0) {
            that.data.person_house_match[0].selected = true;
            that.data.person_house_match[1].selected = false
            that.setData({
              person_house_match: that.data.person_house_match
            })
          } else {
            that.data.person_house_match[0].selected = false;
            that.data.person_house_match[1].selected = true
            that.setData({
              person_house_match: that.data.person_house_match
            })
          }
          wx.hideLoading()
        }

      }
    })
  },

  chooseHouse(e) {
    console.log(e)
    this.setData({
      chooseIdx: e.detail.value,
      flag20: 1
    })
  },

  chooseType(e) {
    console.log(e)
    this.setData({
      chooseIdx2: e.detail.value,
      flag21: 1
    })
  },

  bindMultiPickerColumnChange: function (e) {
    console.log('修改的列为', e.detail.column, '，值为', e.detail.value);
    let data = {
      multiIndex: this.data.multiIndex,
      multiObjArray: this.data.multiObjArray
    }
    data.multiIndex[e.detail.column] = e.detail.value
    switch (e.detail.column) {
      case 0:
        for (let i in this.data.comArr) {
          if (data.multiIndex[0] == i) {
            data.multiObjArray[1] = this.data.newArr[i]
          }
        }
        data.multiIndex[1] = 0;
        break
    }
    this.setData(data)
  },

  bindMultiPickerChange(e) {
    console.log(e)
    let comIdx = e.detail.value[0]
    let multiIndex = e.detail.value[1]
    let c_id = this.data.rawData[comIdx].c_id
    let g_id = this.data.gridArr[comIdx][multiIndex].g_id
    this.setData({
      multiIndex: e.detail.value,
      g_id: g_id,
      c_id: c_id,
      flag: 1
    })
  },

  houseChange(e) {
    let item1 = this.data.house
    for (let i = 0, len = item1.length; i < len; ++i) {
      item1[i].checked = item1[i].value === e.detail.value
    }
    this.setData({
      item1
    })
  },

  // 特殊人群
  specialChange(e) {
    console.log(e)
    // let name = e.currentTarget.dataset.name
    this.setData({
      specialIdx: e.detail.value,
      flag1: 1,
    })
  },

  // 释解日期
  freedomChange(e) {
    this.setData({
      freedom: e.detail.value
    })
  },

  // 生日
  birthChange(e) {
    this.setData({
      birth: e.detail.value
    })
  },

  // 与户主关系
  familyChange(e) {
    console.log(e)
    // let name = e.currentTarget.dataset.name
    this.setData({
      familyIdx: e.detail.value,
      flag2: 1
    })
  },

  // 管理类型
  manageChange(e) {
    console.log(e)
    // let name = e.currentTarget.dataset.name
    this.setData({
      manageIdx: e.detail.value,
      flag4: 1
    })
  },

  // 结婚日期
  marryChange(e) {
    this.setData({
      marry: e.detail.value
    })
  },

  // 婚姻状况
  marryRemarkChange(e) {
    this.setData({
      marryIdx: e.detail.value,
      flag5: 1
    })
  },

  // 籍贯
  bindRegionChange(e) {
    this.setData({
      region: e.detail.value
    })
  },

  // 宗教信仰
  religionChange(e) {
    this.setData({
      religionIdx: e.detail.value,
      flag7: 1
    })
  },

  // 政治面貌
  politicsChange(e) {
    this.setData({
      politicsIdx: e.detail.value,
      flag6: 1
    })
  },

  // 学历
  eduChange(e) {
    this.setData({
      eduIdx: e.detail.value,
      flag8: 1
    })
  },

  // 职业类别
  jobChange(e) {
    this.setData({
      jobIdx: e.detail.value,
      flag9: 9
    })
  },

  // 户籍地
  residenceChange(e) {
    this.setData({
      residence: e.detail.value
    })
  },

  // 人户一致
  personHouseMatchChange(e) {
    let item1 = this.data.person_house_match
    for (let i = 0, len = item1.length; i < len; ++i) {
      item1[i].checked = item1[i].value === e.detail.value
    }
    this.setData({
      item1
    })
  },

  // 现住地
  liveChange(e) {
    this.setData({
      current_live_place: e.detail.value
    })
  },

  // 健康状况
  healthChange(e) {
    this.setData({
      healthIdx: e.detail.value,
      flag10: 1
    })
  },

  // 社会职务
  societyDutyChange(e) {
    this.setData({
      societyDutyIdx: e.detail.value,
      flag11: 11
    })
  },

  // 节育措施
  birthControlChange(e) {
    this.setData({
      birthControlIdx: e.detail.value,
      flag12: 12
    })
  },

  // 血型
  bloodChange(e) {
    this.setData({
      bloodIdx: e.detail.value,
      flag13: 1
    })
  },

  // 特长
  skillChange(e) {
    this.setData({
      skillIdx: e.detail.value,
      flag14: 14
    })
  },

  // 户籍类别
  residenceTypeChange(e) {
    this.setData({
      residenceTypeIdx: e.detail.value,
      flag15: 1
    })
  },

  // 兵役
  militaryChange(e) {
    this.setData({
      militaryIdx: e.detail.value,
      flag16: 1
    })
  },

  // 民族
  nationChange(e) {
    console.log(e)
    this.setData({
      nationIdx: e.detail.value,
      flag3: 1
    })
  },

  genderChange(e) {
    let item1 = this.data.gender
    for (let i = 0, len = item1.length; i < len; ++i) {
      item1[i].checked = item1[i].value === e.detail.value
    }
    this.setData({
      item1
    })
  },

  volunteerChange(e) {
    let volunteer = this.data.volunteer
    for (let i = 0, len = volunteer.length; i < len; ++i) {
      volunteer[i].checked = volunteer[i].value === e.detail.value
    }
    this.setData({
      volunteer
    })
  },

  formSubmit(e) {
    console.log(e)
    console.log(this.data.houseList)
    console.log(this.data.nationArr[this.data.nationIdx].value)
    let { crime_name, freedom_date, name, used_name, id_card, birth_day, marry_date, job, contact_tel, current_live_address, work_company, work_duty, residence_area, height, room_num, remark, has_house, gender, person_house_match, is_volunteer, residence_address } = e.detail.value
    let access_token = wx.getStorageSync('access_token')
    let birth_place = e.detail.value.birth_place.join(';')
    let residence_place = e.detail.value.residence_place.join(';')
    let current_live_place = e.detail.value.current_live_place.join(';')
    let special_type = this.data.specialArr[this.data.specialIdx].value
    let family_relation = this.data.familyArr[this.data.familyIdx].value
    let nation = this.data.nationArr[this.data.nationIdx].value
    let manage_type = this.data.manageArr[this.data.manageIdx].value
    let marry_remark = this.data.marryArr[this.data.marryIdx].value
    let politics_face = this.data.politicsArr[this.data.politicsIdx].value
    let religion_belief = this.data.religionArr[this.data.religionIdx].value
    let job_type = this.data.jobArr[this.data.jobIdx].value
    let educational = this.data.eduArr[this.data.eduIdx].value
    let health_remark = this.data.healthArr[this.data.healthIdx].value
    let society_duty = this.data.societyDutyArr[this.data.societyDutyIdx].value
    let birth_control_method = this.data.birthControlArr[this.data.birthControlIdx].value
    let blood_type = this.data.bloodArr[this.data.bloodIdx].value
    let skilled_in = this.data.skillArr[this.data.skillIdx].value
    let residence_type = this.data.residenceTypeArr[this.data.residenceTypeIdx].value
    let military_service_remark = this.data.militaryArr[this.data.militaryIdx].value
    let h_id = this.data.houseList[this.data.chooseIdx].h_id
    let type_id = this.data.typeList[this.data.chooseIdx2].type_id
    // let {c_id,g_id} = this.data
    // if(this.data.c_id == '' || this.data.g_id == ''){
    //   wx.showToast({
    //     title: '所属社区不能为空！',
    //     icon:'none'
    //   })
    //   return false
    // }
    if (special_type == '') {
      wx.showToast({
        title: '请选择是否为特殊人群！',
        icon: 'none'
      })
      return false
    }
    if (e.detail.value.name == '') {
      wx.showToast({
        title: '姓名不能为空！',
        icon: 'none'
      })
      return false
    }
    if (family_relation == '') {
      wx.showToast({
        title: '请选择与户主关系！',
        icon: 'none'
      })
      return false
    }
    if (id_card == '') {
      wx.showToast({
        title: '身份证号码不能为空！',
        icon: 'none'
      })
      return false
    }
    if (gender == '') {
      wx.showToast({
        title: '请选择性别！',
        icon: 'none'
      })
      return false
    }
    if (nation === '') {
      wx.showToast({
        title: '请选择民族！',
        icon: 'none'
      })
      return false
    }
    if (birth_day == '') {
      wx.showToast({
        title: '请选择出生日期！',
        icon: 'none'
      })
      return false
    }
    if (manage_type == '') {
      wx.showToast({
        title: '请选择管理类型！',
        icon: 'none'
      })
      return false
    }
    if (marry_remark == '') {
      wx.showToast({
        title: '请选择婚姻状况！',
        icon: 'none'
      })
      return false
    }
    if (politics_face == '') {
      wx.showToast({
        title: '请选择政治面貌！',
        icon: 'none'
      })
      return false
    }
    if (religion_belief == '') {
      wx.showToast({
        title: '请选择宗教信仰！',
        icon: 'none'
      })
      return false
    }
    if (educational == '') {
      wx.showToast({
        title: '请选择学历！',
        icon: 'none'
      })
      return false
    }
    if (contact_tel == '') {
      wx.showToast({
        title: '联系方式不能为空！',
        icon: 'none'
      })
      return false
    }
    if (current_live_address == '') {
      wx.showToast({
        title: '现住地详址不能为空！',
        icon: 'none'
      })
      return false
    }
    if (work_company == '') {
      wx.showToast({
        title: '工作单位不能为空！',
        icon: 'none'
      })
      return false
    }
    if (crime_name == '') {
      this.setData({
        crime_name: ''
      })
    }
    wx.showLoading({
      title: '正在提交...',
      mask: true
    })
    wx.request({
      url: 'https://baokang.wshoto.com/wx/personadd',
      method: 'POST',
      header: {
        "Content-Type": "application/x-www-form-urlencoded"
      },
      data: {
        // c_id:c_id,
        // g_id:g_id,
        id: this.data.id,
        special_type: special_type,
        family_relation: family_relation,
        nation: nation,
        manage_type: manage_type,
        marry_remark: marry_remark,
        politics_face: politics_face,
        religion_belief: religion_belief,
        // job_type:job_type,
        educational: educational,
        health_remark: health_remark,
        // society_duty:society_duty,
        // birth_control_method:birth_control_method,
        blood_type: blood_type,
        // skilled_in:skilled_in,
        residence_type: residence_type,
        military_service_remark: military_service_remark,
        access_token: access_token,
        crime_name: this.data.crime_name,
        freedom_date: freedom_date,
        name: name,
        has_house: has_house,
        used_name: used_name,
        gender: gender,
        id_card: id_card,
        person_house_match: person_house_match,
        // is_volunteer:is_volunteer,
        birth_day: birth_day,
        marry_date: marry_date,
        job: job,
        residence_address: residence_address,
        contact_tel: contact_tel,
        current_live_address: current_live_address,
        work_company: work_company,
        work_duty: work_duty,
        residence_area: residence_area,
        height: height,
        room_num: room_num,
        remark: remark,
        birth_place: birth_place,
        residence_place: residence_place,
        current_live_place: current_live_place,
        h_id: h_id,
        person_type: type_id
      },
      success: (res) => {
        console.log(res)
        wx.hideLoading()
        if (res.data.code == 1) {
          wx.showModal({
            content: res.data.msg,
            showCancel: false,
            success: (res) => {
              if (res.confirm) {
                wx.navigateBack()
              }
            }
          })
        } else {
          wx.showModal({
            content: res.data.msg,
            showCancel: false,
          })
        }
      }
    })
  }
})